﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace LibraryTest
{
    /// <namespace>
    /// 命名空间的注释
    /// </namespace>
    /// <summary>
    /// 创建一个关于人的类
    /// </summary>
    public class Person
    {
        /// <summary>
        /// 人的姓名
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 人的年纪
        /// </summary>
        public int Age { get; set; }

        /// <summary>
        /// 根据传入的姓名和年龄，创建一个Person类
        /// </summary>
        /// <param name="name">姓名</param>
        /// <param name="age">年龄</param>
        public Person(string name, int age)
        {
            Name = name;
            Age = age;
        }

        /// <summary>
        /// 创建一个Person类，具有默认的姓名和年龄
        /// </summary>
        public Person() :this("Tom", 20){ }

        /// <summary>
        /// 吃饭的方法
        /// </summary>
        /// <param name="food">食物</param>
        /// <returns>是否吃完了</returns>
        public bool Eat(string food)
        {
            Console.WriteLine("Eating {food}.....");
            return true;
        }
    }

    /// <summary>
    /// 一个关于学生的类，继承于Person类
    /// </summary>
    public class Student : Person
    {
        /// <summary>
        /// 学生的学号
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 初始化学生类
        /// </summary>
        public Student()
        {
            Id = 1;
        }

        /// <summary>
        /// 做家庭作业
        /// </summary>
        /// <param name="obj">科目</param>

        public void Homework(string obj)
        {
            Console.WriteLine("正在做{obj}.....");
        }
    }
}
